import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/head',
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login/login.vue')
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/Home/home.vue'),
    children: [
      {
        path: '',
        redirect: 'home/estateManagement'
      },
      {
        path: 'estateManagement',
        name: 'HomeEstateManagement',
        component: () => import('../views/Home/EstateManagement/estateManagement.vue'),
        children: [
          {
            path: '',
            redirect: 'home/estateManagement/first'
          },
          {
            path: 'first',
            name: 'HomeEstateManagementFirst',
            component: () => import('../views/Home/EstateManagement/First/first.vue')
          },
          {
            path: 'residentCertification',
            name: 'HomeEstateManagementResidentCertification',
            component: () => import('../views/Home/EstateManagement/ResidentCertification/residentCertification.vue')
          },
          {
            path: 'housingResources',
            name: 'Home-EstateManagement-HousingResources',
            component: () => import('../views/Home/EstateManagement/HousingResources/housingResources.vue')
          },
          {
            path: 'housingArchives',
            name: 'HomeEstateManagementHousingArchives',
            component: () => import('../views/Home/EstateManagement/HousingArchives/housingArchives.vue')
          }, 
          {
            path: 'user',
            name: 'user',
            component: () => import('../views/Home/User/user.vue')
          },
          {
            path: 'examine',
            name: 'Examine',
            component: () => import('../views/Home/EstateManagement/Examine/examine.vue')
          },
          {
            path: 'nothing',
            name: 'nothing',
            component: () => import('../views/Nothing/nothing.vue')
          }
        ]
      },
      {
        path: 'equipment',
        name: 'HomeEquipment',
        component: () => import('../views/Home/Equipment/equipment.vue')
      },
      {
        path: 'operate',
        name: 'HomeOperate',
        component: () => import('../views/Home/Operate/operate.vue')
      },
      {
        path: 'user',
        name: 'HomeUser',
        component: () => import('../views/Home/User/user.vue'),
      },
    ]
  },
  {
    path: '/head',
    name: 'Head',
    component: () => import('../views/Head/head.vue')
  }

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
